< previous page page_748 next page >

Page 748
Listing 19.22. continued
    '
    intResult = SQLExecDirect(hStmt, strAddSQL, Len(strAddSQL))
    If intResult <> sqlSuccess Then
        sqlErrorMsg "Unable to add row"
        intResult = SQLFreeStmt(hStmt, sqlClose)
    End If
    '
End Sub
As you can see, this routine first executes a DELETE query, and then it executes an INSERT statement.
Save the class module. You now have completed the ODBC library routines. The next step is to build a simple data-entry form that uses the ODBC library to open a dataset and pass information to and from the data via the ODBC interface.
Using the ODBC Library to Create a Data-Entry Form
Now that you have your ODBC library, you are ready to build a data-entry form that uses the ODBC interface for database access. For this example, you build a simple data-entry form that has the usual navigation buttons (First, Next, Back, and Last) and the record buttons (Add, Delete, and Update).
You write this form by using the new class library in a way that is almost identical to the way you create a data-entry form using the standard data control. You add controls, set a few properties, and then execute a few methods.
Building the ODBC Test Data-Entry Form
Add a new Standard EXE project to the current project group (the one with the prjODBC project). Use Figure 19.10 and Table 19.1 as a guide for laying out the test form.
0748-01.jpg
Figure 19.10.
Laying out the SQLTest form.

 
< previous page page_748 next page >

If you like this book, buy it!